#include "csvparser.h"

#include <QFile>
#include <QTextStream>

#include <iostream>

CSVParser::CSVParser()
{
}

void CSVParser::Parse(const QString& filename,std::vector<QStringList>& table)
{
    QFile inputFile(filename);
    if (inputFile.open(QIODevice::ReadOnly))
    {
       QTextStream in(&inputFile);
       while (!in.atEnd()){
          QString line = in.readLine();
          QStringList row=line.split(",");
          table.push_back(row);
       }
       inputFile.close();
    }
    else
    {
        std::cout<<"Cannot find file "<<filename.toStdString()<<std::endl;
    }
}
